<template>
  <a-drawer :open="visible" title="收款单详情" @close="onClose">
    <template #closeIcon>
      <div class="express-bar"></div>
      <div class="express-btn">
        <CloseCircleOutlined :size="32" @click="onClose" />
      </div>
    </template>
    <a-card size="small" title="基本信息">
      <a-row>
        <a-col :span="20">
          <a-descriptions size="small" :column="3">
            <a-descriptions-item label="单据编号">{{ options.no }}</a-descriptions-item>
            <a-descriptions-item label="交款人">{{ options.payee_name }}</a-descriptions-item>
            <a-descriptions-item label="交易流水号">{{ options.trade_no }}</a-descriptions-item>
            <a-descriptions-item label="收款类型">
              <span>{{ getDescByValue('PAY_STATUS_ENUM', options.pay_type) }}</span>
            </a-descriptions-item>
            <a-descriptions-item label="收款金额">{{ options.amount }}</a-descriptions-item>
            <a-descriptions-item label="收款时间">{{ options.create_time }}</a-descriptions-item>
            <a-descriptions-item label="审核状态">
              <span>{{ getDescByValue('STATUS_TY_ENUM', options.status) }}</span>
            </a-descriptions-item>
            <a-descriptions-item label="备注">{{ options.remark }}</a-descriptions-item>
          </a-descriptions>
        </a-col>
        <a-col :span="4">
          <a-image :width="90" :src="options.voucher" />
        </a-col>
      </a-row>
    </a-card>
    <template #footer>
      <a-button @click="onClose">取消</a-button>
    </template>
  </a-drawer>
</template>

<script setup lang="ts">
import { useEnums } from '@/hooks/plugins/useEnums'

const { getDescByValue } = useEnums()

defineExpose({
  showDrawer
})
const emit = defineEmits(['refresh'])

// --------------------- Drawer 显示与隐藏 ---------------------
// 是否展示
const visible = ref(false)
// 详情
const options = ref({})

function showDrawer(item) {
  options.value = item
  visible.value = true
}

const onClose = () => {
  visible.value = false
}
</script>
